package com.eis.persist.dao.util;

import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.util.List;

import org.springframework.jdbc.core.BatchPreparedStatementSetter;

public class DeleteGroupFunctionBatchSetter implements BatchPreparedStatementSetter {
	private List<Integer> bizGroupIds;
	private String functionId;
	
	public DeleteGroupFunctionBatchSetter(List<Integer> bizGroupIds, String functionId) {
		this.bizGroupIds = bizGroupIds;
		this.functionId = functionId;
	}
	
	@Override
	public void setValues(PreparedStatement ps, int i) throws SQLException {
		ps.setInt(1, bizGroupIds.get(i));
		ps.setString(2, functionId);
	}

	@Override
	public int getBatchSize() {
		if (bizGroupIds != null) {
			return bizGroupIds.size();
		} else {
			return 0;
		}
	}

}
